
const CONSOLE_LEVEL = ['debug', 'log', 'info', 'warn', 'error']
export function overrideConsole () {
  if (window && window.console) {
    const n = CONSOLE_LEVEL.length
    for (let i = 0; i < n; i++) {
      const level = CONSOLE_LEVEL[i]
      const action = window.console[level]
      window.console[level] = function (...args) {
        // var s = {
        //   type: "console",
        //   data: {
        //     level,
        //     message: JSON.stringify(args),
        //   }
        // }; // 需要上报的数据
        action && action.apply(null, [...args])
      }
    }
  }
}
